#!/usr/bin/make -f

EXT_VERSION = `curl -Ls -o /dev/null -w %{url_effective} "https://github.com/listen1/listen1_chrome_extension/releases/latest" | sed 's/.*\/v\(.*\)/\1/g'`

%:
	dh ${@}


override_dh_auto_build:
	curl -Lo extension.tar.gz https://github.com/listen1/listen1_chrome_extension/archive/v$(EXT_VERSION).tar.gz
	tar xzf extension.tar.gz
	mv listen1_chrome_extension-*/* app/listen1_chrome_extension/
	cp app/resources/logo.png Listen1.png
	cd app && npm_config_cache=./npm_cache npm install && npm prune --production
	rm -f app/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}
	rm -rf app/node_modules/.cache
	rm -rf app/npm_cache

